package com.woniu.goodsservice.service.impl;

import com.woniu.goodsservice.entity.Goodscomments;
import com.woniu.goodsservice.dao.GoodscommentsDao;
import com.woniu.goodsservice.service.GoodscommentsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("goodscommentsService")
public class GoodscommentsServiceImpl implements GoodscommentsService {
    @Resource
    private GoodscommentsDao goodscommentsDao;

    @Override
    public Goodscomments queryById(Integer id) {
        return goodscommentsDao.queryById(id);
    }

    @Override
    public List<Goodscomments> queryAllByLimit(int offset, int limit) {
        return goodscommentsDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<Goodscomments> findAll() {
        return goodscommentsDao.findAll();
    }

    @Override
    public Goodscomments insert(Goodscomments goodscomments) {
        goodscommentsDao.insert(goodscomments);
        return goodscomments;
    }

    @Override
    public Goodscomments update(Goodscomments goodscomments) {
        goodscommentsDao.update(goodscomments);
        return queryById(goodscomments.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return goodscommentsDao.deleteById(id) > 0;
    }
}